package com.example.demo.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.hutool.core.date.DateUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/**
 * @author: jamesfu
 * @date: 2023-04-02 22:24
 */
@Getter
@Setter
public class EmployWorkDay {

    @Excel(name = "工作时间", format = "yyyy/MM/dd")
    private Date workDate;

    @Excel(name = "我的工时（h）")
    private String workHour;

    @Excel(name = "项目编码")
    private String projectNo;

    @Excel(name = "项目名称")
    private String projectName;

    @Excel(name = "员工编号")
    private String employeeNo;

    @Excel(name = "员工姓名")
    private String employeeName;

    @Excel(name = "公司名称")
    private String companyName;

    @Excel(name = "部门编码")
    private String departmentNo;

    @Excel(name = "部门名称")
    private String departmentName;

    @Excel(name = "备注")
    private String memo;

    @Excel(name = "审批人编号")
    private String auditEmployeeNo;

    @Excel(name = "审批人")
    private String auditEmployeeName;

    @Excel(name = "审批状态")
    private String auditStatus;

    @Excel(name = "审批时间", format = "yyyy/MM/dd HH:mm:ss")
    private Date auditDate;

    @Excel(name = "添加时间", format = "yyyy/MM/dd HH:mm:ss")
    private Date addDate;

    @Excel(name = "是否重复")
    private String duplicateLabel;

    public String getDuplicateKey() {
        return DateUtil.format(this.getWorkDate(), "yyyy/MM/dd") + this.getDepartmentName() + this.getEmployeeName();
    }

    public static EmployWorkDay copyFrom(EmployWorkDay employWorkDay, Date workDate) {
        EmployWorkDay to = new EmployWorkDay();
        to.setWorkDate(workDate);
        to.setProjectNo(employWorkDay.getProjectNo());
        to.setProjectName(employWorkDay.getProjectName());
        to.setEmployeeNo(employWorkDay.getEmployeeNo());
        to.setEmployeeName(employWorkDay.getEmployeeName());
        to.setDepartmentNo(employWorkDay.getDepartmentNo());
        to.setDepartmentName(employWorkDay.getDepartmentName());
        to.setCompanyName(employWorkDay.getCompanyName());
        to.setMemo(employWorkDay.getMemo());
        to.setAuditEmployeeNo(employWorkDay.getAuditEmployeeNo());
        to.setAuditEmployeeName(employWorkDay.getAuditEmployeeName());
        to.setAuditStatus(employWorkDay.getAuditStatus());
        to.setAuditDate(employWorkDay.getAuditDate());

        return to;
    }
}
